package com.matt.domain.course;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.matt.commons.model.Domain;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/11/22
 * *******************************
 */
@Entity
@Table(name = "course_child")
@Data
@EqualsAndHashCode(callSuper = true)
public class CourseChild extends Domain{

    /**
     * 名称
     */
    private String name;

    /**
     * 视频
     */
    private String videoAddress;

    /**
     * 视频封面
     */
    private String videoImg;

    /**
     * 课程id
     */
    private String courseId;

    /**
     * 父级id
     */
    private String parentId;

    /**
     * 祖级id
     */
    private String ancestorsId;

    /**
     * 类型：1章节，2小节
     */
    private Integer type;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(columnDefinition = "ddatetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' ")
    private Date created = new Date();

    private Integer status = 0;


    /**
     * 创建人Id
     */
    private String createdId;

    /**
     * 子章节
     */
    @Transient
    private List<CourseChild> childList;


    /**
     * 是否存在子章节 true:是  false:否
     */
    @Transient
    private boolean hasChild;


    @Transient
    private Integer chapterNum;

    //优先级
    @Column(columnDefinition = " int DEFAULT 0 COMMENT ' 优先级 ' ")
    private Integer priority;


}
